#include "CustomCharacterController.h"

#include "InputsManager.h"



void MeatBoyController::update(ccTime dt)
{
	// special Meat Boy

	if( INPUTS->GetKeyState( KEY_ID::KEY_RUN ).Pressed )
	{
		XForce = AccXSolSpeedOn;
		AirAcc = AccXAirSpeedOn;
		maxXVelocity = MaxSpeedSpeedOn;

		IsSpeedOn = true;
	}
	else if( INPUTS->GetKeyState( KEY_ID::KEY_RUN ).Released )
	{
		XForce = AccXSolSpeedOff;
		AirAcc = AccXAirSpeedOff;
		maxXVelocity = MaxSpeedSpeedOff;

		IsSpeedOn = false;
	}
	
	MarioController::update(dt);
}

void MeatBoyController::draw(CCPoint Offset)
{
	BasicCharacterController::draw(Offset);

	if( IsSpeedOn )
	{
		glColor4f(0.0f, 0.0f, 1.0f, 1.0f );

		ccDrawCircle( CCPoint(  m_body->GetPosition().x *PTM_RATIO  -Offset.x,  m_body->GetPosition().y *PTM_RATIO - Offset.y ), 0.25f *PTM_RATIO, 0.0f, 20, false );
	}

	if( IsForcingTouchingWall() )
	{
		glColor4f(0.0f, 1.0f, 1.0f, 1.0f );

		ccDrawCircle( CCPoint(  m_body->GetPosition().x *PTM_RATIO -Offset.x ,  m_body->GetPosition().y *PTM_RATIO -Offset.y), 0.3f *PTM_RATIO, 0.0f, 20, false );
	}
}